symplely/coroutine

View on GitHub

Showing 180 of 236 total issues

Function elements has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  protected function elements(iterable ...$items): array
  {
    $elements = [];
    if (isset($items[0]) && \is_array($items[0])) {
      foreach ($items as $key => $value) {
Severity: Minor
Found in Coroutine/Misc/Datatype/Dict.php - About 45 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

Method mailWriter has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    $to,
    $subject = null,
    array $headers = [],
    $levels = self::ALL,
    $interval = 1,
Severity: Minor
Found in Coroutine/Logger/Logger.php - About 45 mins to fix

    Method mailWriter has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        $to,
        $subject = null,
        array $headers = [],
        $levels = self::ALL,
        $interval = 1,
    Severity: Minor
    Found in Coroutine/Logger/AsyncLoggerInterface.php - About 45 mins to fix

      Function getReturn has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getReturn()
          {
              if ($this->isTerminated()) {
                  return !empty($this->result) ? $this->result : $this->finishResult;
              } elseif (!$this->isStarted() || $this->isActive() || $this->isErred()) {
      Severity: Minor
      Found in Coroutine/Fiber/Fiber.php - About 45 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 listenerTask has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        public static function listenerTask(callable $handler)
        {
          return Kernel::away(function () use ($handler) {
            $coroutine = \coroutine();
            $tid = yield \stateless_task();
      Severity: Minor
      Found in Coroutine/Networks.php - About 45 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 deeply nested control flow statements.
      Open

                    if ($enabled === true)
                      break;
      Severity: Major
      Found in Coroutine/Networks.php - About 45 mins to fix

        Function addEvent has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          protected function addEvent($stream)
          {
            if (!isset($this->events[(int) $stream])) {
              $meta = \stream_get_meta_data($stream);
              switch ($meta['stream_type'] ?? '') {
        Severity: Minor
        Found in Coroutine/Coroutine.php - About 45 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 ioWaiting has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          protected function ioWaiting()
          {
            $isUv = $this->isUv();
            while (true) {
              if ($this->isCoroutinesDone()) {
        Severity: Minor
        Found in Coroutine/Coroutine.php - About 45 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 deeply nested control flow statements.
        Open

                    if (!$this->future->isEmpty())
                      continue;
        Severity: Major
        Found in Coroutine/Coroutine.php - About 45 mins to fix

          Method request has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              string $method = 'GET',
              string $path = '/',
              ?string $type = 'text/html',
              $data = null,
              array ...$extra
          Severity: Minor
          Found in Coroutine/SocketMessage.php - About 35 mins to fix

            Method net_response has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                $object,
                ?string $body = null,
                ?int $status = null,
                ?string $type = 'text/html',
                array ...$extra
            Severity: Minor
            Found in Coroutine/Socket.php - About 35 mins to fix

              Method recvfrom_into has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                public function recvfrom_into(&$buffer, $nBytes, $flags = \MSG_DONTWAIT, &$address = null, &$port = null);
              Severity: Minor
              Found in Coroutine/Misc/Network/SocketsInterface.php - About 35 mins to fix

                Method updateCompleted has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    int $taskId,
                    array $completeList = [],
                    ?callable $onClear = null,
                    bool $cancel = false,
                    bool $forceUpdate = false
                Severity: Minor
                Found in Coroutine/CoroutineInterface.php - About 35 mins to fix

                  Method server has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      $uri,
                      ?OptionsInterface $context = null,
                      ?string $capath = None,
                      ?string $cafile = None,
                      array $caSelfDetails = []
                  Severity: Minor
                  Found in Coroutine/Networks.php - About 35 mins to fix

                    Method recvfrom_into has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                      public function recvfrom_into(&$buffer, $nBytes, $flags = \MSG_DONTWAIT, &$address = null, &$port = null)
                    Severity: Minor
                    Found in Coroutine/Misc/Network/Sockets.php - About 35 mins to fix

                      Method logger_writer has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          callable $writer,
                          $levels = Logger::ALL,
                          int $interval = 1,
                          callable $formatter = null,
                          $name = null
                      Severity: Minor
                      Found in Coroutine/Loggers.php - About 35 mins to fix

                        Method net_server has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            $uri = null,
                            ?OptionsInterface $context = null,
                            ?string $capath = None,
                            ?string $cafile = None,
                            array $caSelfDetails = []
                        Severity: Minor
                        Found in Coroutine/Socket.php - About 35 mins to fix

                          Method logger_syslog has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              $logOpts = \LOG_PID | \LOG_ODELAY | \LOG_CONS,
                              $facility = \LOG_USER,
                              $levels = Logger::ALL,
                              callable $formatter = null,
                              $name = null
                          Severity: Minor
                          Found in Coroutine/Loggers.php - About 35 mins to fix

                            Method logger_stream has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                $stream = 'php://stdout',
                                $levels = Logger::ALL,
                                int $interval = 1,
                                callable $formatter = null,
                                $name = null
                            Severity: Minor
                            Found in Coroutine/Loggers.php - About 35 mins to fix

                              Method spawn_signal has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  $command,
                                  int $signal = 0,
                                  $signalTask = null,
                                  $timeout = 0,
                                  bool $display = false
                              Severity: Minor
                              Found in Coroutine/Worker.php - About 35 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language