src/Driver/RabbitMQ/RabbitMQService.php
The class RabbitMQService has 13 public methods. Consider refactoring RabbitMQService to keep number of public methods under 10. Open
Open
class RabbitMQService implements AMQPService
{
/**
* @var AMQPConnection
*/
- Read upRead up
- Exclude checks
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
Open
public function consumeMessage(AMQPChannel $channel, string $consumerTag, string $queue, callable $callback, int $timeout = 0): void
Method publishMessage
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public function publishMessage(AMQPChannel $channel, string $body, array $properties, string $exchange, string $routingKey): void
Avoid using IntegrationTesting\Driver\RabbitMQ\count() function in while loops. Open
Open
while (count($channel->callbacks)) {
$channel->wait(null, false, $timeout);
}
- Read upRead up
- Exclude checks
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
Open
public function publishMessage(AMQPChannel $channel, string $body, array $properties, string $exchange, string $routingKey): void
- Exclude checks
Line exceeds 120 characters; contains 136 characters Open
Open
public function consumeMessage(AMQPChannel $channel, string $consumerTag, string $queue, callable $callback, int $timeout = 0): void
- Exclude checks