symplely/coroutine

View on GitHub

Showing 209 of 236 total issues

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

  public function response(
    ?string $body = null,
    ?int $status = null,
    ?string $type = 'text/html',
    array ...$extra
Severity: Minor
Found in Coroutine/SocketMessage.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

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

  public static function await(string $label, ...$arguments)
  {
    switch ($label) {
      case 'sleep':
      case 'sleep_for':
Severity: Minor
Found in Coroutine/Kernel.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

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

  public function request(
    string $method = 'GET',
    string $path = '/',
    ?string $type = 'text/html',
    $data = null,
Severity: Minor
Found in Coroutine/SocketMessage.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

Function __construct has a Cognitive Complexity of 10 (exceeds 5 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));
Severity: Minor
Found in Coroutine/Misc/Network/Sockets.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

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

  protected function executeFiber(Fiber $fiber)
  {
    // Skip and reschedule, if `fiber` in suspend state
    if ($fiber->isSuspended())
      return $this->scheduleFiber($fiber);
Severity: Minor
Found in Coroutine/Coroutine.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 bind has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public static function bind(string $scheme, string $address, int $port)
  {
    $uv = \coroutine()->getUV();
    $ip = (\strpos($address, ':') === false)
      ? \uv_ip4_addr($address, $port)
Severity: Minor
Found in Coroutine/Networks.php - About 1 hr to fix

    Method write has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      public static function write($handle, $data = '')
      {
        if (self::isUv() && $handle instanceof \UV) {
          if (\uv_is_closing($handle))
            return false;
    Severity: Minor
    Found in Coroutine/Networks.php - About 1 hr to fix

      Method close has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        public function close()
        {
          $object = $this->customData;
          if (\is_object($object)) {
            if (\method_exists($object, 'close'))
      Severity: Minor
      Found in Coroutine/Task.php - About 1 hr to fix

        Method result has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          public function result()
          {
            if ($this->isCompleted()) {
              $result = $this->result;
              if ($this->customData instanceof FutureInterface)
        Severity: Minor
        Found in Coroutine/Task.php - About 1 hr to fix

          Method timeout has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            public function timeout()
            {
              $coroutine = \coroutine();
              $timeout = $this->clock;
              $task = $this->withTask();
          Severity: Minor
          Found in Coroutine/Misc/TimeoutAfter.php - About 1 hr to fix

            Method request has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              public function request(
                string $method = 'GET',
                string $path = '/',
                ?string $type = 'text/html',
                $data = null,
            Severity: Minor
            Found in Coroutine/SocketMessage.php - About 1 hr to fix

              Method addFuture has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  $command,
                  $timeout = 0,
                  bool $display = false,
                  $channel = null,
                  $channelTask = null,
              Severity: Major
              Found in Coroutine/Kernel.php - About 1 hr to fix

                Function _fopen has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  function _fopen(string $path = null, string $flag = 'r', int $mode = \S_IRWXU, $contexts = null)
                  {
                    $retry = 0;
                    while (true) {
                      $fd  = yield FileSystem::open($path, $flag, $mode, $contexts);
                Severity: Minor
                Found in Coroutine/Path.php - About 55 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 joinTask has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  public static function joinTask(int $tid)
                  {
                    return new Kernel(
                      function (TaskInterface $task, CoroutineInterface $coroutine) use ($tid) {
                        $join = $coroutine->getTask($tid);
                Severity: Minor
                Found in Coroutine/Kernel.php - About 55 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 get_local has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  public function get_local()
                  {
                    if ($this->secured) {
                      if (\is_resource($this->stream))
                        return \stream_socket_get_name($this->stream, false);
                Severity: Minor
                Found in Coroutine/Misc/Network/Sockets.php - About 55 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 get_peer has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  public function get_peer()
                  {
                    if ($this->secured) {
                      if (\is_resource($this->stream))
                        return \stream_socket_get_name($this->stream, true);
                Severity: Minor
                Found in Coroutine/Misc/Network/Sockets.php - About 55 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 __call has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  public function __call($function, $args)
                  {
                    if (!$this->withSet) {
                      yield $this->withSet();
                    }
                Severity: Minor
                Found in Coroutine/Misc/ContextTrait.php - About 55 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 clearTimeout has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  public function clearTimeout(TaskInterface $task): void
                  {
                    $timer = $task->getTimer();
                    if ($this->isUv() && $timer instanceof \UVTimer && \uv_is_active($timer)) {
                      @\uv_timer_stop($timer);
                Severity: Minor
                Found in Coroutine/Coroutine.php - About 55 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 updateCompleted has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  public function updateCompleted(
                    int $taskId,
                    array $completeList = [],
                    ?callable $onClear = null,
                    bool $cancel = false,
                Severity: Minor
                Found in Coroutine/Coroutine.php - About 55 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 logger_mail has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    string $to = '',
                    $subject = '',
                    array $headers = [],
                    $levels = Logger::ALL,
                    int $interval = 1,
                Severity: Major
                Found in Coroutine/Loggers.php - About 50 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language