symplely/coroutine

View on GitHub

Showing 209 of 236 total issues

Function close has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  public function close(): void
  {
    if (!$this->closed) {
      $this->shutdown(2);
      $this->clearError();
Severity: Minor
Found in Coroutine/Misc/Network/Sockets.php - About 35 mins 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

Function timeout has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  public function timeout()
  {
    $coroutine = \coroutine();
    $timeout = $this->clock;
    $task = $this->withTask();
Severity: Minor
Found in Coroutine/Misc/TimeoutAfter.php - About 35 mins 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

Function shutdown has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  public function shutdown(int $how = 2)
  {
    if ($this->secured) {
      if (\is_resource($this->stream))
        \stream_socket_shutdown($this->stream, $how);
Severity: Minor
Found in Coroutine/Misc/Network/Sockets.php - About 35 mins 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

Function addSignal has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  public function addSignal($signal, $listener)
  {
    if (!$this->signaler)
      return;

Severity: Minor
Found in Coroutine/Coroutine.php - About 35 mins 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

Function ioSocketStream has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  protected function ioSocketStream($timeout)
  {
    if (empty($this->waitingForRead) && empty($this->waitingForWrite)) {
      return;
    }
Severity: Minor
Found in Coroutine/Coroutine.php - About 35 mins 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

Function __construct has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  private function __construct($prev, $callback, $args, $recover = false)
  {
    if ($recover) {
      self::$isRecoverable = true;
      self::$recoverable = $callback;
Severity: Minor
Found in Coroutine/Defer.php - About 35 mins 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

Avoid too many return statements within this method.
Open

    return isset($meta[$info]) ? $meta[$info] : $meta;
Severity: Major
Found in Coroutine/FileSystem.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

            return yield Kernel::gather(...$arguments);
    Severity: Major
    Found in Coroutine/Kernel.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return yield $misc_function(...$arguments);
      Severity: Major
      Found in Coroutine/Kernel.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

              return yield $file_function(...$arguments);
        Severity: Major
        Found in Coroutine/Kernel.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return @$label(...$arguments);
          Severity: Major
          Found in Coroutine/Kernel.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                  return yield Co::getFunction($label)(...$arguments);
            Severity: Major
            Found in Coroutine/Kernel.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return yield Kernel::spawnTask($system, 0, $display);
              Severity: Major
              Found in Coroutine/Kernel.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                      return yield awaitable_future(function () use ($system, $display) {
                        return Kernel::addFuture($system, 0, $display);
                      });
                Severity: Major
                Found in Coroutine/Kernel.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                        return yield $function(...$arguments);
                  Severity: Major
                  Found in Coroutine/Kernel.php - About 30 mins to fix

                    Function __timeoutAfter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      protected static function __timeoutAfter(float $timeout = 0.0, $callable = null, ...$args)
                      {
                        return yield yield new Kernel(
                          function (TaskInterface $task, CoroutineInterface $coroutine) use ($callable, $timeout, $args) {
                            $skip = false;
                    Severity: Minor
                    Found in Coroutine/Kernel.php - About 25 mins 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

                    Function needName has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function needName()
                    {
                        $i = 1;
                        yield \sleep_for(1);
                        while (true) {
                    Severity: Minor
                    Found in examples/waitFor.php - About 25 mins 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

                    Function union has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      public function union(...$items): array
                      {
                        $current = [];
                        $elements = $this->elements(...$items);
                        if (\count($elements) > 0) {
                    Severity: Minor
                    Found in Coroutine/Misc/Datatype/Set.php - About 25 mins 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

                    Function connect has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      public static function connect(string $scheme, string $address, int $port, $data = null)
                      {
                        return new Kernel(
                          function (TaskInterface $task, CoroutineInterface $coroutine) use ($scheme, $address, $port, $data) {
                            $callback =  function ($client, $status) use ($task, $coroutine) {
                    Severity: Minor
                    Found in Coroutine/Networks.php - About 25 mins 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

                    Function file_delete has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      function file_delete($dir)
                      {
                        $dir = slash_switch($dir);
                    
                        // @codeCoverageIgnoreStart
                    Severity: Minor
                    Found in Coroutine/Path.php - About 25 mins 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

                    Severity
                    Category
                    Status
                    Source
                    Language