hrodic/php-integration-testing

View on GitHub
src/Driver/RabbitMQ/RabbitMQService.php

Summary

Maintainability
A
1 hr
Test Coverage

The class RabbitMQService has 13 public methods. Consider refactoring RabbitMQService to keep number of public methods under 10.
Open

class RabbitMQService implements AMQPService
{
    /**
     * @var AMQPConnection
     */

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

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

    public function consumeMessage(AMQPChannel $channel, string $consumerTag, string $queue, callable $callback, int $timeout = 0): void
Severity: Minor
Found in src/Driver/RabbitMQ/RabbitMQService.php - About 35 mins to fix

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

        public function publishMessage(AMQPChannel $channel, string $body, array $properties, string $exchange, string $routingKey): void
    Severity: Minor
    Found in src/Driver/RabbitMQ/RabbitMQService.php - About 35 mins to fix

      Avoid using IntegrationTesting\Driver\RabbitMQ\count() function in while loops.
      Open

              while (count($channel->callbacks)) {
                  $channel->wait(null, false, $timeout);
              }

      CountInLoopExpression

      Since: 2.7.0

      Using count/sizeof in loops expressions is considered bad practice and is a potential source of many bugs, especially when the loop manipulates an array, as count happens on each iteration.

      Example

      class Foo {
      
        public function bar()
        {
          $array = array();
      
          for ($i = 0; count($array); $i++) {
            // ...
          }
        }
      }

      Source https://phpmd.org/rules/design.html#countinloopexpression

      Line exceeds 120 characters; contains 133 characters
      Open

          public function publishMessage(AMQPChannel $channel, string $body, array $properties, string $exchange, string $routingKey): void

      Line exceeds 120 characters; contains 136 characters
      Open

          public function consumeMessage(AMQPChannel $channel, string $consumerTag, string $queue, callable $callback, int $timeout = 0): void

      There are no issues that match your filters.

      Category
      Status