symplely/thread_queue

View on GitHub

Showing 19 of 19 total issues

File UVFunctions.php has 460 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * create a `new` loop handle.
 *
Severity: Minor
Found in Threads/Uv/UVFunctions.php - About 7 hrs to fix

    Thread has 31 functions (exceeds 20 allowed). Consider refactoring.
    Open

    final class Thread
    {
        /** @var array[string|int => int|\UVAsync] */
        protected $threads = [];
    
    
    Severity: Minor
    Found in Threads/Thread.php - About 3 hrs to fix

      File Thread.php has 324 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      declare(strict_types=1);
      
      namespace Async\Threads;
      Severity: Minor
      Found in Threads/Thread.php - About 3 hrs to fix

        Method create has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function create($tid, callable $task, ...$args): ?TWorker
            {
                $tid = \is_scalar($tid) ? $tid : (int) $tid;
                if (!isset($this->threads[$tid])) {
                    \uv_mutex_lock($this->lock);
        Severity: Minor
        Found in Threads/Thread.php - About 1 hr to fix

          Function join has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              public function join($tid = null): void
              {
                  $isCoroutine = self::isCoroutine($this->loop);
                  $isCancelling = !empty($tid) && $this->isCancelled($tid);
                  while (!empty($tid) ? ($this->isRunning($tid) || $this->isCancelled($tid)) : !$this->isEmpty()) {
          Severity: Minor
          Found in Threads/Thread.php - About 1 hr 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 uv_spawn has 9 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              UVLoop $loop,
              string $command,
              array $args,
              array $stdio,
              string $cwd,
          Severity: Major
          Found in Threads/Uv/UVFunctions.php - About 1 hr to fix

            Function handlers has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function handlers($tid): void
                {
                    if ($this->isSuccessful($tid)) {
                        if ($this->hasLoop) // @codeCoverageIgnoreStart
                            $this->loop->executeTask($this->success, $tid);
            Severity: Minor
            Found in Threads/Thread.php - About 1 hr 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 uv_fs_sendfile has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            function uv_fs_sendfile(UVLoop $loop, $out_fd, $in_fd, int $offset, int $length, callable $callback)
            Severity: Minor
            Found in Threads/Uv/UVFunctions.php - About 45 mins to fix

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

              function uv_fs_open(UVLoop $loop, string $path, int $flag, int $mode, callable $callback)
              Severity: Minor
              Found in Threads/Uv/UVFunctions.php - About 35 mins to fix

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

                function uv_fs_write(UVLoop $loop, $fd, string $buffer, int $offset = -1, callable $callback)
                Severity: Minor
                Found in Threads/Uv/UVFunctions.php - About 35 mins to fix

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

                  function uv_fs_utime(UVLoop $loop, string $path, int $utime, int $atime, callable $callback)
                  Severity: Minor
                  Found in Threads/Uv/UVFunctions.php - About 35 mins to fix

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

                    function uv_getaddrinfo(UVLoop $loop, callable $callback, string $node = null, string $service = null, array $hints = [])
                    Severity: Minor
                    Found in Threads/Uv/UVFunctions.php - About 35 mins to fix

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

                      function uv_fs_symlink(UVLoop $loop, string $from, string $to, int $flags, callable $callback)
                      Severity: Minor
                      Found in Threads/Uv/UVFunctions.php - About 35 mins to fix

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

                        function uv_fs_chown(UVLoop $loop, string $path, int $uid, int $gid, callable $callback)
                        Severity: Minor
                        Found in Threads/Uv/UVFunctions.php - About 35 mins to fix

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

                          function uv_fs_read(UVLoop $loop, $fd, int $offset, int $length, callable $callback)
                          Severity: Minor
                          Found in Threads/Uv/UVFunctions.php - About 35 mins to fix

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

                            function uv_fs_fchown(UVLoop $loop, $fd, int $uid, int $gid, callable $callback)
                            Severity: Minor
                            Found in Threads/Uv/UVFunctions.php - About 35 mins to fix

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

                              function uv_fs_futime(UVLoop $loop, $fd, int $utime, int $atime, callable $callback)
                              Severity: Minor
                              Found in Threads/Uv/UVFunctions.php - About 35 mins to fix

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

                                    public function cancel($tid = null): void
                                    {
                                        if (isset($this->status[$tid])) {
                                            \uv_mutex_lock($this->lock);
                                            $this->status[$tid] = ['cancelled'];
                                Severity: Minor
                                Found in Threads/Thread.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 triggerError has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function triggerError($tid)
                                    {
                                        if (isset($this->exception[$tid])) {
                                            $exception = $this->exception[$tid];
                                            if ($this->isYield)
                                Severity: Minor
                                Found in Threads/Thread.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

                                Severity
                                Category
                                Status
                                Source
                                Language