symplely/spawn

View on GitHub

Showing 33 of 114 total issues

Method __construct has 9 arguments (exceeds 4 allowed). Consider refactoring.
Open

    $process,
    int $id,
    int $timeout = 60,
    array $stdio = [],
    \UVTimer $timer = null,
Severity: Major
Found in Spawn/Future.php - About 1 hr to fix

    Method __construct has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      public function __construct(
        $loop = null,
        callable $timedOutCallback = null,
        callable $finishCallback = null,
        callable $failCallback = null,
    Severity: Minor
    Found in Spawn/FutureHandler.php - About 1 hr to fix

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

          public static function create(
              $task,
              int $timeout = 0,
              $input = null,
              bool $isYield = null
      Severity: Minor
      Found in Spawn/Spawn.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 close has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        public function close()
        {
          if (!empty($this->parallel)) {
            foreach ($this->parallel as $future) {
              if ($future instanceof FutureInterface) {
      Severity: Minor
      Found in Spawn/Parallel.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

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

      <?php
      $lock = uv_mutex_init();
      
      if (uv_mutex_trylock($lock)) {
          echo "OK" . PHP_EOL;
      Severity: Major
      Found in examples/uv/mutex.php and 1 other location - About 1 hr to fix
      examples/uv/wrlock.php on lines 1..17

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 102.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

        public function processing()
        {
          if (!empty($this->futures)) {
            foreach ($this->futures as $future) {
              if (!$future->isStarted()) {
      Severity: Minor
      Found in Spawn/FutureHandler.php - About 1 hr to fix

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

        <?php
        $lock = uv_rwlock_init();
        
        if (uv_rwlock_trywrlock($lock)) {
            echo "OK" . PHP_EOL;
        Severity: Major
        Found in examples/uv/wrlock.php and 1 other location - About 1 hr to fix
        examples/uv/mutex.php on lines 1..17

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 102.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Consider simplifying this complex logical expression.
        Open

            if (
              !Globals::isChannelling() && null !== $value && $this->process === null && !\is_resource($value)
              && ($this->capacity > $this->buffered->count() || $this->capacity == -1) && $this->type === 'buffered'
            ) {
              try {
        Severity: Major
        Found in Spawn/Channeled.php - About 1 hr to fix

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          $pid = uv_spawn(
              $loop,
              "php",
              array('-r', 'echo "Now spawning! " . PHP_EOL;do {echo "*";usleep(1000);} while (true);'),
              $stdio,
          Severity: Minor
          Found in examples/uv/async_flow_with_others.php and 1 other location - About 45 mins to fix
          examples/uv/async_flows_with_queue_zts.php on lines 78..94

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 95.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              $pid = uv_spawn(
                  $loop,
                  "php",
                  array('-r', 'echo "Now spawning! " . PHP_EOL;do {echo "*";usleep(500);} while (true);'),
                  $stdio,
          Severity: Minor
          Found in examples/uv/async_flows_with_queue_zts.php and 1 other location - About 45 mins to fix
          examples/uv/async_flow_with_others.php on lines 76..92

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 95.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                  if ($counter > 100) {
                      echo 'finish';
                      uv_close($async, function (UV $handle) {
                          print ' with first';
                      });
          Severity: Minor
          Found in examples/uv/async_flows_with_queue_zts.php and 1 other location - About 40 mins to fix
          examples/uv/async_flow_with_others.php on lines 101..118

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 93.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

              if ($counter == 100) {
                  echo 'finish';
                  uv_close($async, function (UV $handle) {
                      print ' with first';
                  });
          Severity: Minor
          Found in examples/uv/async_flow_with_others.php and 1 other location - About 40 mins to fix
          examples/uv/async_flows_with_queue_zts.php on lines 113..130

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 93.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

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

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

                      $loop = null,
                      ?callable $timedOutCallback = null,
                      ?callable $finishCallback = null,
                      ?callable $failCallback = null,
                      ?callable $signalCallback  = null
                  Severity: Minor
                  Found in Spawn/Parallel.php - About 35 mins to fix

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

                        $loop = null,
                        callable $timedOutCallback = null,
                        callable $finishCallback = null,
                        callable $failCallback = null,
                        callable $signalCallback = null
                    Severity: Minor
                    Found in Spawn/FutureHandler.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 Spawn/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 Spawn/Uv/UVFunctions.php - About 35 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language