symplely/coroutine

View on GitHub

Showing 180 of 236 total issues

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/Coroutine.php - About 35 mins to fix

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

        $command,
        $channel = null,
        $channelTask = null,
        $timeout = 0,
        bool $display = false
    Severity: Minor
    Found in Coroutine/Worker.php - About 35 mins to fix

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

        public function log($level, $message, array $context = [])
        {
          if (false === $level = \array_search($level, self::$levels, true)) {
            yield $this->close();
            throw new InvalidArgumentException(\sprintf("Unknown logger(%s) level name: '%s'", $this->name, $level));
      Severity: Minor
      Found in Coroutine/Logger/Logger.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 close has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        public function close(): void
        {
          if ($this->withSet)
            $this->clearWith();
      
      
      Severity: Minor
      Found in Coroutine/Misc/ContextTrait.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

        public function __construct(array $tasks = [], string $wait = 'all')
        {
          $coroutine = \coroutine();
          $this->wait = $wait;
          foreach ($tasks as $tid) {
      Severity: Minor
      Found in Coroutine/Misc/TaskGroup.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 tick has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        public function tick(FutureInterface $future)
        {
          if (!$this->coroutine instanceof CoroutineInterface || $this->isKilling)
            return;
      
      
      Severity: Minor
      Found in Coroutine/Parallel.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 progressTask has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        public static function progressTask(callable $handler)
        {
          return Kernel::away(function () use ($handler) {
            yield;
            while (true) {
      Severity: Minor
      Found in Coroutine/Kernel.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 logger_shutdown has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        function logger_shutdown()
        {
          $loggerTags = Log::allLogs();
          if (!empty($loggerTags)) {
            $names = \array_keys((array) $loggerTags);
      Severity: Minor
      Found in Coroutine/Loggers.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 wait has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        public function wait(): array
        {
          while (true) {
            if (!$this->coroutine instanceof CoroutineInterface)
              break;
      Severity: Minor
      Found in Coroutine/Parallel.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 ending has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        function ending(ContextInterface $context)
        {
          try {
            if ($context() instanceof \Generator)
              yield $context();
      Severity: Minor
      Found in Coroutine/Core.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 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 write has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        public function write(string $data, ?int $length = 0)
        {
          $count = false;
          $length = (empty($length) ? \strlen($data) : $length);
          if ($this->closed) {
      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 __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

      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 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

      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 $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 Co::getFunction($label)(...$arguments);
          Severity: Major
          Found in Coroutine/Kernel.php - About 30 mins to fix
            Severity
            Category
            Status
            Source
            Language